// Actually set the 'patrolled' flag in RC
$this->reallyMarkPatrolled();
// Log this patrol event
- PatrolLog::record( $this, $auto );
+ PatrolLog::record( $this, $auto, $user );
wfRunHooks( 'MarkPatrolledComplete', array($this->getAttribute('rc_id'), &$user, false) );
return array();
}
# Log auto-patrolled edits
if ( $patrolled ) {
- PatrolLog::record( $rc, true );
+ PatrolLog::record( $rc, true, $user );
}
}
$user->incEditCount();
# Log auto-patrolled edits
if ( $patrolled ) {
- PatrolLog::record( $rc, true );
+ PatrolLog::record( $rc, true, $user );
}
}
$user->incEditCount();
*
* @param $rc Mixed: change identifier or RecentChange object
* @param $auto Boolean: was this patrol event automatic?
+ * @param $performer User: user performing the action or null to use $wgUser
*
* @return bool
*/
- public static function record( $rc, $auto = false ) {
+ public static function record( $rc, $auto = false, User $user = null ) {
if ( !$rc instanceof RecentChange ) {
$rc = RecentChange::newFromId( $rc );
if ( !is_object( $rc ) ) {
$title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) );
if( $title ) {
- global $wgUser;
+ if ( !$user ) {
+ global $wgUser;
+ $user = $wgUser;
+ }
$entry = new ManualLogEntry( 'patrol', 'patrol' );
$entry->setTarget( $title );
$entry->setParameters( self::buildParams( $rc, $auto ) );
- $entry->setPerformer( $wgUser );
+ $entry->setPerformer( $user );
$logid = $entry->insert();
if ( !$auto ) {
$entry->publish( $logid, 'udp' );